<template>
	<view>
		<view id="test">
			这是a组件中的数据：{{name}}
		</view>
		<view>
			这是a组件: <button @click="sengmasg"> 给b组件传递值</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: "cuiyt"
			};
		},
		beforeMount() {
			console.info("组件a挂载之前")
			console.info(document.getElementById("test"))
		},
		mounted() {
			console.info("组件a挂载")
			console.info(document.getElementById("test"))
		},
		created() {
			console.info("组件a被创建")
			console.info(document.getElementById("test"))
		},
		destroyed() {
			console.info("组件a被销毁")
		},
		methods: {
			sengmasg() {
				uni.$emit("update", 20)
			}
		}
	}
</script>

<style>

</style>
